package com.chixing.day07_abstract.prototype;

public class Product {
    private int pId;
    private String proName;
    private float proPrice;

    public Product(){}
    public Product(int pId, String proName, float proPrice) {
        this.pId = pId;
        this.proName = proName;
        this.proPrice = proPrice;
    }

    public int getpId() {
        return pId;
    }

    public void setpId(int pId) {
        this.pId = pId;
    }

    public String getProName() {
        return proName;
    }

    public void setProName(String proName) {
        this.proName = proName;
    }

    public float getProPrice() {
        return proPrice;
    }

    public void setProPrice(float proPrice) {
        this.proPrice = proPrice;
    }

    @Override
    protected Product clone() throws CloneNotSupportedException {
        //product 的克隆对象
        Product proClone = new Product();
        proClone.pId = this.pId;
        proClone.proName = this.proName;
        proClone.proPrice = this.proPrice;
        return proClone;
    }

    //浅克隆
    @Override
    public String toString() {
        return "Product{" +
                "pId=" + pId +
                ", proName='" + proName + '\'' +
                ", proPrice=" + proPrice +
                '}';
    }
}
